import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vLoading from "@/directives/loading.js"
import vLazy from "@/directives/lazy.js";
import "./eventBus.js";

// 导入iconfont图标
import "@/assets/icons/iconfont.css";

// 导入全局样式
import "@/styles/global.less";

import showMessage from "./utils/showMessage";

store.dispatch("setting/fetchSetting");
Vue.prototype.$showMessage = showMessage;

// 注册全局指令
Vue.directive("loading", vLoading);
Vue.directive("lazy", vLazy);

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')


// 测试时间总线
// import eventBus from "./eventBus";

// function handler1(data) {
//   console.log("handler1", data)
// }
// function handler2(data) {
//   console.log("handler2", data)
// }
// eventBus.$on('event1', handler1);
// eventBus.$on('event1', handler2);
// eventBus.$on('event2', handler1);

// window.eventBus = eventBus;
// window.handler1 = handler1; 

